﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace WmsApp.UI
{
    public partial class QOutStoreBillBorrowRepair : QOutStoreBill
    {
        public QOutStoreBillBorrowRepair()
        {
            InitializeComponent();
        }

        public new  string GetCondition()
        {
            string condition = base.GetCondition();

            DateTime dt;
            if (this.dateEditReturnDate.EditValue != null && DateTime.TryParse(this.dateEditReturnDate.Text.Trim(),out dt))
            {
                condition += (String.Format(" and LEN(ExtVarChar2) >0 and  Convert(datetime,ExtVarChar2,120)>= Convert(datetime,'{0}',120) ", this.dateEditReturnDate.Text.Trim()));
            }

            if (this.dateEditReturnDate2.EditValue != null && DateTime.TryParse(this.dateEditReturnDate2.Text.Trim(), out dt))
            {
                condition += (String.Format(" and LEN(ExtVarChar2) >0 and  Convert(datetime,ExtVarChar2,120)<= Convert(datetime,'{0}',120) ", this.dateEditReturnDate2.Text.Trim()));
            }

            if(!String.IsNullOrEmpty(this.textEditTroubleReason.Text.Trim()))
            {
                condition += (String.Format(" and ExtVarChar3 like '%{0}%'", this.textEditTroubleReason.Text.Trim()));
            }

            return condition;
        }
    }
}
